package co.edu.usbcali.raju.games.chess.model;

import co.edu.usbcali.raju.games.chess.ChessGame;
import co.edu.usbcali.raju.model.IEvaluator;
import co.edu.usbcali.raju.model.IMoveChooser;
import co.edu.usbcali.raju.model.Move;
import aima.core.search.adversarial.IterativeDeepeningAlphaBetaSearch;

public class AlphaBetaSearch extends
		IterativeDeepeningAlphaBetaSearch<ChessBoard, Move, String> implements IMoveChooser<ChessBoard, Move>
{

	public AlphaBetaSearch( int time) {
		super (new ChessGame(),  ChessGame.MIN_UTILITY, ChessGame.MAX_UTILITY, time);
//		setLogEnabled(true);
	}

	@Override
	public void setEvaluator(IEvaluator evaluator) {
		getGame().setEvaluator(evaluator);
	}
	
	private ChessGame getGame(){
		return (ChessGame)game;
	}
	@Override
	protected double eval(ChessBoard state, String player) {
			return game.getUtility(state, player);
	}
}
